package cn.online.taxi.manager.dto;

import cn.online.taxi.manager.dto.front.CarInfo;
import cn.online.taxi.manager.dto.front.Driver;
import cn.online.taxi.manager.dto.front.DriverReceiving;
import cn.online.taxi.manager.dto.front.Passenger;
import cn.online.taxi.manager.pojo.TbCarInfo;
import cn.online.taxi.manager.pojo.TbDriver;
import cn.online.taxi.manager.pojo.TbPassenger;

/**
 * @Author BinBini
 * @Date 2021/3/18 16:15
 * @Version 1.0
 */
public class DtoUtil {

    public static Passenger TbPassengerToPassenger(TbPassenger tbPassenger) {
        Passenger passenger = new Passenger();

        passenger.setId(tbPassenger.getId());
        passenger.setUsername(tbPassenger.getUsername());
        passenger.setPhone(tbPassenger.getPhone());
        passenger.setEmail(tbPassenger.getEmail());
        passenger.setSex(tbPassenger.getSex());
        passenger.setAddress(tbPassenger.getAddress());
        passenger.setFile(tbPassenger.getFile());
        passenger.setDescription(tbPassenger.getDescription());
        passenger.setCreated(tbPassenger.getCreated());
        passenger.setUpdated(tbPassenger.getUpdated());

        return passenger;
    }

    public static Driver TbDriverToDriver(TbDriver tbDriver) {
        Driver driver = new Driver();

        driver.setId(tbDriver.getId());
        driver.setPhone(tbDriver.getPhone());
        driver.setDriverLeader(tbDriver.getDriverLeader());
        driver.setDriverName(tbDriver.getDriverName());
        driver.setRegisterTime(tbDriver.getRegisterTime());
        driver.setBalance(tbDriver.getBalance());
        driver.setSex(tbDriver.getSex());
        driver.setCarId(tbDriver.getCarId());
        driver.setIsFollowing(tbDriver.getIsFollowing());
        driver.setWorkStatus(tbDriver.getWorkStatus());
        driver.setHeadImg(tbDriver.getHeadImg());
        driver.setCityCode(tbDriver.getCityCode());
        driver.setBindTime(tbDriver.getBindTime());
        driver.setUseStatus(tbDriver.getUseStatus());
        driver.setCsWorkStatus(tbDriver.getCsWorkStatus());
        driver.setSignStatus(tbDriver.getSignStatus());
        driver.setCreated(tbDriver.getCreated());
        driver.setUpdated(tbDriver.getUpdated());

        return driver;
    }

    public static DriverReceiving TbDriverToDriverReceiving(TbDriver tbDriver) {
        DriverReceiving driverReceiving = new DriverReceiving();

        driverReceiving.setDriverId(tbDriver.getId());
        driverReceiving.setPhone(tbDriver.getPhone());
        driverReceiving.setDriverName(tbDriver.getDriverName());
        driverReceiving.setCarId(tbDriver.getCarId());

        return driverReceiving;
    }

    public static TbCarInfo CarInfoToTbCarInfo(CarInfo carInfo) {
        TbCarInfo tbCarInfo = new TbCarInfo();

        tbCarInfo.setPlateNumber(carInfo.getPlateNumber());
        tbCarInfo.setFullName(carInfo.getFullName());
        tbCarInfo.setCarImg(carInfo.getCarImg());
        tbCarInfo.setRemark(carInfo.getRemark());
        tbCarInfo.setCarTypeId(carInfo.getCarTypeId());
        tbCarInfo.setCarLevelId(carInfo.getCarLevelId());
        tbCarInfo.setRegistDate(carInfo.getRegistDate());

        return tbCarInfo;
    }

}
